<template>
  <el-result
    :icon="success ? 'success' : 'error'"
    :title="success ? '添加成功' : '添加失败'"
    :subTitle="title"
  >
    <template slot="extra">
      <el-button type="primary" @click="back" size="medium">上 一 步</el-button>
      <el-button type="primary" @click="exit" size="medium">退 出</el-button>
      <el-button type="primary" @click="again" size="medium">继 续 添 加 新 商 品</el-button>
    </template>
  </el-result>
</template>

<script>
export default {
  name: 'pubResult',
  data() {
    return {
      success: true,
      title: undefined
    }
  },
  methods: {
    init(success, data, msg) {
      if (success) {
        this.success = true
        this.title = '您已成功添加编号为 ' + data + ' 的商品'
      } else {
        this.success = false
        this.title = msg
      }
    },
    back() {
      this.$emit('back')
    },
    again() {
      this.$tab.refreshPage()
    },
    exit() {
      this.$tab.closePage()
    }
  }
}
</script>

<style scoped>

</style>
